package Servlet;

import Verification.VerifyCode;
import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.awt.image.BufferedImage;
import java.io.IOException;

@WebServlet(name = "VerifyCode", value = "/VerifyCode")
public class VerifyCodeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        VerifyCode vc = new VerifyCode();
        BufferedImage bi = vc.getImage();
        String text = vc.getText();
        request.getSession().setAttribute("text", text);
        vc.output(bi, response.getOutputStream());

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
